/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import model.Categoria;

/**
 *
 * @author Cristian
 */
//PADRAO FACTORY METHOD
public class ActionFactoryLivro {
    public static Categoria create(String categoria){
      Categoria actionObject = null;
           
      String nomeClasse = "model.Categoria" + categoria;
      Class classe = null;
      Object object = null;
        try {
            classe = Class.forName(nomeClasse);
            object = classe.newInstance();
           } catch (Exception e) {
               return null;
           }
      
        if(!(object instanceof Categoria)) return null;
        actionObject = (Categoria) object;
        return actionObject;
    
     }    
}
